package com.bjpowernode.boss;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@MapperScan(value = "com.bjpowernode.boss.db.mapper")
@SpringBootApplication
public class PaymentApplication {
	/**
	 * 内存
	 */
	public static final Map<String,Object> CACHEMAP = new HashMap<>();
	/**
	 * 添加分页
	 */
	@Bean
	public MybatisPlusInterceptor mybatisPlusInterceptor() {
		MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
		interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
		return interceptor;
	}
	@Bean
	public ThreadPoolExecutor threadPoolExecutor(){
		return new ThreadPoolExecutor(9,18,5, TimeUnit.MINUTES,new LinkedBlockingQueue<>());
	}
	public static void main(String[] args) {
		SpringApplication.run(PaymentApplication.class, args);
	}

}
